package cjq.demo.thread.ch6_4;

import java.util.concurrent.PriorityBlockingQueue;

/**
 * Created by Administrator on 2016/5/4.
 */
public class Task implements Runnable {

    private int id;

    private PriorityBlockingQueue<Event> queue;

    public Task(int id,PriorityBlockingQueue<Event> queue){
        this.id = id;
        this.queue = queue;
    }

    public void run(){
        for (int i = 0; i < 1000; i++) {
            Event event = new Event(id,i);
            queue.add(event);
        }
    }
}
